﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NewWords
{
    public partial class NewWordDialog : Form
    {
        public NewWordDialog()
        {
            InitializeComponent();
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            string cmd = "insert into word(spell, phonetic, explanation, comment) values("
                + "\'" + this.textBoxSpell.Text + "\',"
                + "\'" + this.textBoxPhonetic.Text + "\',"
                + "\'" + this.textBoxExplanation.Text + "\',"
                + "\'" + this.textBoxComment.Text + "\'"
                + ")";
            DbHelper.SQLiteHelper.ExecuteNonQuery(CommandType.Text, cmd, null);
            this.Close();
        }
    }
}
